<template>
  <Form ref="registerForm" :model="form" @keydown.enter.native="handleSubmit">
    <FormItem prop="userPhone">
      <label class="common_login">
        <span>手机号</span>
        <Input prefix="ios-contact" placeholder="请输入手机号" v-model="form.userPhone"/>
      </label>
    </FormItem>
    <FormItem prop="password">
      <label class="common_login">
        <span>密码</span>
        <Input prefix="md-lock" placeholder="请输入密码" type="password" v-model="form.password"/>
      </label>
    </FormItem>
    <FormItem prop="password">
      <label class="common_login">
        <span>确认密码</span>
        <Input prefix="md-lock" placeholder="请输入密码" type="password" v-model="form.surePassword"/>
      </label>
    </FormItem>
    <FormItem prop="password">
      <label class="common_login">
        <span>QQ</span>
        <Input prefix="ios-text" placeholder="请输入QQ" type="password" v-model="form.qq"/>
      </label>
    </FormItem>
    <FormItem prop="code">
      <div class="login-code">
        <div>
          <label>
            <span>验证码</span>
            <Input prefix="ios-barcode" placeholder="请输入验证码" v-model="form.code"/>
          </label>
        </div>
        <div>
          <img
            src="http://zjt.zexploit.com/api/verify_code/index" @click="refreshCode"
            title="刷新验证码"
          />
        </div>
      </div>
    </FormItem>
    <FormItem style="margin-top: 30px">
      <Button @click="handleSubmit" type="primary" long>注册</Button>
    </FormItem>
  </Form>
</template>
<script>
export default {
  name: 'RegisterForm',
  props: {

  },
  data() {
    return {
      form: {
        userPhone: '',
        password: '',
        code: '',
        qq:'',
        surePassword:''
      }
    }
  },
  computed: {
    rules() {
      return {}
    }
  },
  methods: {
    refreshCode(){
    },
    handleSubmit() {
      if (this.form.userPhone === '' || this.form.password === '' || this.form.code === ''
      || this.form.surePassword === '' || this.form.qq === '') {
        this.$Notice.error({
          title: '注册失败',
          desc: '手机号，密码，QQ，验证码必填项 '
        });
        return;
      }
      if (this.form.password !== this.form.surePassword) {
        this.$Notice.error({
          title: '注册失败',
          desc: '密码与确认不一致 '
        });
        return;
      }
    }
  }
}
</script>
